<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<!DOCTYPE html>
<html>
<head>
<title>合同列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<%@ include file="/WEB-INF/common.jsp"%>

<link href="${path }/resources/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="${path }/resources/css/animate.css" rel="stylesheet">
<link href="${path }/resources/css/style.css?v=4.1.0" rel="stylesheet">

<!--dataTables css样式-->
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/jquery.dataTables.min.css">
<!--DataTables button扩展-->
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/buttons.dataTables.min.css">


</head>
<body class="gray-bg" style="">
<jsp:include page="/WEB-INF/loginCheck.jsp" />
	<div>
		<h1 style="margin-left:20px">合同列表</h1>
	</div>
	<hr>
	<!--查询条件  -->
	<div id="selectbar" barclass="panel-body" style="margin-top: 30px">
		<!--省市区  -->
		<!-- <div class="btn-group" style="margin-left: 60px">
			<form class="form-inline">
				<div id="distpicker5">
					<div class="form-group">
						<input
							type="text" class="form-control" id="projectName" placeholder="请输入项目名称">
					</div>
					<div class="form-group">
						 <input
							class="form-control" id="proprietorName"placeholder = "请输入业主名称">
					</div>
					<div class="form-group">
						 <input
							class="form-control" id="proprietorName"placeholder = "请输入城市合伙人">
					</div>
					<div class="form-group">
						 <input
							class="form-control" id="proprietorName"placeholder = "请输入维保企业">
					</div>
				</div>
			</form>
		</div> -->
		<!-- <div class="btn-group">
			<button id="submit" class="btn btn-default " type="button">搜索</button>
		</div> -->
		<div class="btn-group" style="margin-top: 5px;margin-left: 15px">
		<%-- <a href="${path }/contract/getContractInfo.htm?Id=-1" class="btn btn-primary" id="addUser">添加</a> --%>
		<a href="${path }/contract/getProprietorAndProjectName.htm" class="btn btn-primary" id="addUser">添加</a>
		</div>
       
	</div>
	
  	<!--表格  -->
 	<div class="col-md-12 col-sm-12 col-xs-12" style="margin-top: 30px">
		<table id="contractList" class="table table-bordered table-striped" style="width:100%">
			<thead>
				<tr>
					<th>项目名称</th>
					<th>城市</th>
					<th>业主名称</th>
					<th>维保企业</th>
					<th>签订日期</th>
					<th>结束日期</th>
					<th>添加建筑物</th>
					<th>添加维保项目</th>
					<th>项目负责人</th>
					<!-- <th>项目位置</th> -->
					<th>状态</th>
					<th>操作</th>
				</tr>
			</thead>
			
		</table>
	</div>
 
	
	<!-- Peity-->
	<script src="${path }/resources/js/plugins/peity/jquery.peity.min.js"></script>
	
	<!-- Bootstrap table-->
	<script src="${path }/resources/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
	<script src="${path }/resources/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

	<!-- 自定义js-->
	<script src="${path }/resources/js/content.js?v=1.0.0"></script>
	
	<!-- jQuery Validation plugin javascript-->
    <script src="${path }/resources/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${path }/resources/js/plugins/validate/messages_zh.min.js"></script>
   
   	<!-- jQuery form  -->
    <script src="${path }/resources/js/jquery.form.min.js"></script>
    
    <!-- layer javascript -->
    <script src="${path }/resources/js/plugins/layer/layer.min.js"></script>
    
    	<!--DataTables 核心 js-->
	<script src="${path }/resources/js/jquery.dataTables.min.js"></script>
	<!--DataTables button扩展-->
	<script
		src="${path }/resources/js/dataTables.buttons.min.js"></script>
	<!--DataTables 导出相关js文件-->
	<script src="${path }/resources/js/buttons.html5.min.js"></script>
	<script src="${path }/resources/js/jszip.min.js"></script>
	<!-- 省市联动 -->
	<script src="${path }/resources/js/distpicker.data.js"></script>
	<script src="${path }/resources/js/distpicker.js"></script>
	<script src="${path }/resources/js/main.js"></script>
    	<!-- datatables日期格式化 -->
	<script src="${path }/resources/js/moment.min.js"></script>
	<script type="text/javascript">

	var province;
	var city;
	var district;

	   //  var data= ${contractList};  
	    var data = ${content};
	   
	    //for(var i=0;i<=${content}.length)
         //然后 DataTables 这样初始化：
         $('#contractList').DataTable( {
        	 data: data,
                	 //"dom": 'lrfBtip',
         	 language: { 
         		"paginate": {
         	          "processing": "正在处理中。。。"
         	        },
         	      //"sProcessing": "处理中...",  
         	      "sLengthMenu": "显示 _MENU_ 项结果",  
         	      "sZeroRecords": "没有匹配结果",  
         	      "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",  
         	      "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",  
         	      "sInfoFiltered": "(由 _MAX_ 项结果过滤)",  
         	      "sInfoPostFix": "",  
         	      "sSearch": "搜索:",  
         	      "sUrl": "",  
         	      "sEmptyTable": "表中数据为空",  
         	      "sLoadingRecords": "载入中...",  
         	      "sInfoThousands": ",",  
         	      "oPaginate": {  
         	          "sFirst": "首页",  
         	          "sPrevious": "上页",  
         	          "sNext": "下页",  
         	          "sLast": "末页"  
         	      },  
         	      "oAria": {  
         	          "sSortAscending": ": 以升序排列此列",  
         	          "sSortDescending": ": 以降序排列此列"  
         	      }  
         	  }  ,
              "iDisplayLength":15,
          	  "lengthMenu":[10,15,20], 
              "buttons": [
                        {
                    	   extend: 'excelHtml5',
                    	   exportOptions: {
                           	'columns':'0,1,2,3,4,5,6,7,8,9,10',//指定需导出的列，默认全部

                           }, 
                           text:"导出",
                           title:"合同列表导出",
                       }
                    ],
        	  "columns": [ 
		             { "data": "project_name" ,
		            	"orderable": false, // 禁用排序	 
		             },
		             { "data": "city" ,
		            	"orderable": false, // 禁用排序	 
		             },
		             { "data": "proprietor",
		            	"orderable": false, // 禁用排序	 
		             },
		             { "data": "enterprise",
		            	 "orderable": false, // 禁用排序
		             },
		             { "data": "sign_date",
						 "defaultContent": "",
						 "render": function (data, type, row, meta) {
	            		  		return moment(data).format("YYYY/MM/DD");
						 }
		             },
		             { "data": "end_date", 
		            	 "defaultContent": "",
						 "render": function (data, type, row, meta) {
	            		  		return moment(data).format("YYYY/MM/DD");
						 }	 
		             },
		             { "data": "Id",
		            	 "orderable": false, // 禁用排序
		            	 "render": function (data, type, row, meta) {
      	                      return data = '<a href="${path }/building/getAllBuilding.htm?id=' + data + '" class="btn btn-info btn-xs"><i class="fa fa-pencil"></i> 添加建筑物 </a>';
      	                             }
		             },
		             { "data": "Id",
		            	 "orderable": false, // 禁用排序
		            	 "render": function (data, type, row, meta) {
     	                      return data = '<a href="${path }/contract/searchMaintenance.htm?Id=' + data + '" class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i> 添加维保项目 </a>';
     	                             }
		             },
		             { "data": "name",
		            	 "orderable": false, // 禁用排序
		             },
		             { "data": "status",
		            	 "orderable": false, // 禁用排序
		             },
                     {
   	                  "data": "Id",
   	                  "orderable": false, // 禁用排序
   	                  "defaultContent": "",
   	                  "render": function (data, type, row, meta) {
   	                      return data = '<a href="${path }/contract/getContractInfo.htm?Id=' + data + '" class="btn btn-default btn-xs"><i class="fa fa-folder"></i> 编辑 </a>';           
   	                  }
		             
			   		}],
         } );
	</script>

</body>
</html>